pub fn closures() {
    let color = String::from("red");
    let print = || println!("{}",&color);
    print();
    let reborrow = &color;
    println!("{reborrow}");
    print();
    let moved = &color;
    println!("{moved}");

    let mut count = 0;
    let mut increment = || {
        count += 1;
        println!("{count}");
    };
    increment();
    increment();
    exec(print);
    exec1(print);
    exec2(print);
    println!("{count}");
}
fn exec<F:FnOnce()>(f: F) {
    f()
}
fn exec1<F:FnMut()>(mut f: F) {
    f()
}
fn exec2<F:Fn()>(f: F) {
    f()
}
